package com.token.config;

import com.future.WebFilterOrderEnum;
import com.token.filter.TokenFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

@AutoConfiguration
public class TokenAutoConfig {

    @Bean
    public FilterRegistrationBean<TokenFilter> tokenFilter() {
        TokenFilter tokenFilter = new TokenFilter();
        FilterRegistrationBean<TokenFilter> registrationBean = new FilterRegistrationBean<>(tokenFilter);
        registrationBean.setOrder(WebFilterOrderEnum.TOKEN_FILTER);
        return registrationBean;
    }

}
